package com.victor.service.impl;

import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.victor.dao.PartnersDao;
import com.victor.entity.finefood.Food;
import com.victor.entity.finefood.FoodMeal;
import com.victor.entity.finefood.FoodMealPhoto;
import com.victor.entity.finefood.FoodPhoto;
import com.victor.entity.finefood.FoodPhotoGroup;
import com.victor.entity.finefood.FoodType;
import com.victor.entity.happy.Happy;
import com.victor.entity.happy.HappyPhoto;
import com.victor.entity.happy.HappyPhotoGroup;
import com.victor.entity.happy.HappyTheme;
import com.victor.entity.happy.HappyThemePhoto;
import com.victor.entity.happy.HappyThemeTime;
import com.victor.entity.happy.HappyType;
import com.victor.entity.hotel.Hotel;
import com.victor.entity.hotel.HotelPhoto;
import com.victor.entity.hotel.HotelPhotoGroup;
import com.victor.entity.hotel.HotelRoom;
import com.victor.entity.hotel.HotelRoomExplain;
import com.victor.entity.hotel.HotelRoomLabel;
import com.victor.entity.hotel.HotelRoomPhoto;
import com.victor.entity.hotel.HotelType;
import com.victor.service.PartnersService;

@Service
public class PartnersServiceImpl implements PartnersService {

	@Autowired
	private PartnersDao dao;

	/** 宾馆 **/
	// 获取宾馆列表--通过分类id和搜索内容
	@Override
	public List<Hotel> getHotelList(String t_id, String search) {
		return dao.getHotelList(t_id, search);
	}

	// 查询宾馆详情
	@Override
	public Hotel getHotelXQ(String h_id) {
		return dao.getHotelXQ(h_id);
	}

	// 删除评论
	@Override
	public boolean delHotelComment(String c_id) {
		return dao.delHotelComment(c_id) > 0 ? true : false;
	}

	// 添加宾馆
	@Override
	public boolean addHotel(Hotel hotel) {
		return dao.addHotel(hotel) > 0 ? true : false;
	}

	// 删除宾馆
	@Override
	public boolean delHotel(Integer h_id) {
		return dao.delHotel(h_id) > 0 ? true : false;
	}

	// 获取所有类型
	@Override
	public List<HotelType> getHotelType() {
		return dao.getHotelType();
	}

	// 修改宾馆信息
	@Override
	public boolean updHotel(Hotel hotel) {
		return dao.updHotel(hotel) > 0 ? true : false;
	}

	// 添加图片组
	@Override
	public boolean addHotelPhotoGroup(HotelPhotoGroup hotelPhotoGroup) {
		return dao.addHotelPhotoGroup(hotelPhotoGroup) > 0 ? true : false;
	}

	// 组内添加图片
	@Override
	public boolean addHotelPhoto(HotelPhoto hotelPhoto) {
		return dao.addHotelPhoto(hotelPhoto) > 0 ? true : false;
	}

	// 删除组
	@Override
	public boolean delHotelPhotoGroup(Integer g_id) {
		return dao.delHotelPhotoGroup(g_id) > 0 ? true : false;
	}

	// 删除图片
	@Override
	public boolean delHotelPhoto(String p_id) {
		return dao.delHotelPhoto(p_id) > 0 ? true : false;
	}

	// 获取宾馆房间列表(传宾馆id)
	@Override
	public List<HotelRoom> getHotelRoomByHotelid(String h_id) {
		return dao.getHotelRoomByHotelid(h_id);
	}

	// 获取宾馆房间详情
	@Override
	public HotelRoom getHotelRoomXQ(String r_id) {
		return dao.getHotelRoomXQ(r_id);
	}

	// 删除房间
	@Override
	public boolean delRoom(Integer r_id) {
		return dao.delRoom(r_id) > 0 ? true : false;
	}

	// 添加房间信息返回id
	@Override
	public boolean addRoom(HotelRoom hotelRoom) {
		return dao.addRoom(hotelRoom) > 0 ? true : false;
	}

	// 添加自定义标签list
	@Override
	public boolean addHotelRoomLabel(HotelRoomLabel hotelRoomLabel) {
		return dao.addHotelRoomLabel(hotelRoomLabel) > 0 ? true : false;
	}

	// 添加预定说明list
	@Override
	public boolean addHotelRoomExplain(HotelRoomExplain hotelRoomExplain) {
		return dao.addHotelRoomExplain(hotelRoomExplain) > 0 ? true : false;
	}

	// 添加图片list
	@Override
	public boolean addHotelRoomPhoto(HotelRoomPhoto hotelRoomPhoto) {
		return dao.addHotelRoomPhoto(hotelRoomPhoto) > 0 ? true : false;
	}

	// 修改房间信息
	@Override
	public boolean updRoom(HotelRoom hotelRoom) {
		return dao.updRoom(hotelRoom) > 0 ? true : false;
	}

	// 添加房间图片
	@Override
	public boolean addRoomPhoto(HotelRoomPhoto hotelRoomPhoto) {
		return dao.addRoomPhoto(hotelRoomPhoto) > 0 ? true : false;
	}

	// 删除房间图片
	@Override
	public boolean delRoomPhoto(String p_id) {
		return dao.delRoomPhoto(p_id) > 0 ? true : false;
	}

	// 冻结
	@Override
	public boolean frozenHotel(Integer h_id, String h_frozen_cycle, String h_frozen_starttime, String h_frozen_endtime,
			String h_frozen_title, String h_frozen_details) {
		return dao.frozenHotel(h_id, h_frozen_cycle, h_frozen_starttime, h_frozen_endtime, h_frozen_title,
				h_frozen_details) > 0 ? true : false;
	}

	/** 美食 **/
	// 获取美食店铺列表--通过分类id和搜索内容
	@Override
	public List<Food> getFoodList(String t_id, String search) {
		return dao.getFoodList(t_id, search);
	}

	// 获取美食店铺详情
	@Override
	public Food getFoodXQ(String f_id) {
		return dao.getFoodXQ(f_id);
	}

	// 删除评论
	@Override
	public boolean delFoodComment(Integer c_id) {
		return dao.delFoodComment(c_id) > 0 ? true : false;
	}

	// 添加美食商家
	@Override
	public boolean addFood(Food food) {
		return dao.addFood(food) > 0 ? true : false;
	}

	// 删除美食商家
	@Override
	public boolean delFood(Integer f_id) {
		return dao.delFood(f_id) > 0 ? true : false;
	}

	// 获取所有类型
	@Override
	public List<FoodType> getFoodType() {
		return dao.getFoodType();
	}

	// 修改美食商家
	@Override
	public boolean updFood(Food food) {
		return dao.updFood(food) > 0 ? true : false;
	}

	// 添加图片组
	@Override
	public boolean addFoodPhotoGroup(FoodPhotoGroup foodPhotoGroup) {
		return dao.addFoodPhotoGroup(foodPhotoGroup) > 0 ? true : false;
	}

	// 组内添加图片
	@Override
	public boolean addFoodPhoto(FoodPhoto foodPhoto) {
		return dao.addFoodPhoto(foodPhoto) > 0 ? true : false;
	}

	// 删除组
	@Override
	public boolean delFoodPhotoGroup(String g_id) {
		return dao.delFoodPhotoGroup(g_id) > 0 ? true : false;
	}

	// 删除图片
	@Override
	public boolean delFoodPhoto(Integer p_id) {
		return dao.delFoodPhoto(p_id) > 0 ? true : false;
	}

	// 获取美食列表(传美食商家id)
	@Override
	public List<FoodMeal> getFoodMealByFoodid(String f_id) {
		return dao.getFoodMealByFoodid(f_id);
	}

	// 获取美食详情
	@Override
	public FoodMeal getFoodMealXQ(String m_id) {
		return dao.getFoodMealXQ(m_id);
	}

	// 删除美食套餐
	@Override
	public boolean delMeal(Integer m_id) {
		return dao.delMeal(m_id) > 0 ? true : false;
	}

	// 添加美食套餐
	@Override
	public boolean addMeal(FoodMeal foodMeal) {
		return dao.addMeal(foodMeal) > 0 ? true : false;
	}

	// 添加美食套餐图片
	@Override
	public boolean addFoodMealPhoto(FoodMealPhoto foodMealPhoto) {
		return dao.addFoodMealPhoto(foodMealPhoto) > 0 ? true : false;
	}

	// 修改美食套餐信息
	@Override
	public boolean updMeal(FoodMeal foodMeal) {
		return dao.updMeal(foodMeal) > 0 ? true : false;
	}

	// 添加美食套餐图片
	@Override
	public boolean addMealPhoto(FoodMealPhoto foodMealPhoto) {
		return dao.addMealPhoto(foodMealPhoto) > 0 ? true : false;
	}

	// 删除美食套餐图片
	@Override
	public boolean delMealPhoto(Integer p_id) {
		return dao.delMealPhoto(p_id) > 0 ? true : false;
	}

	// 冻结
	@Override
	public boolean frozenFood(Integer f_id, String frozen_cycle, String frozen_starttime, String frozen_endtime,
			String frozen_title, String frozen_details) {
		return dao.frozenFood(f_id, frozen_cycle, frozen_starttime, frozen_endtime, frozen_title, frozen_details) > 0
				? true
				: false;
	}

	/** 美食 **/
	// 获取娱乐商家列表--通过分类id和搜索内容
	@Override
	public List<Happy> getHappyList(String t_id, String search) {
		return dao.getHappyList(t_id, search);
	}

	// 查询娱乐商家详情
	@Override
	public Happy getHappyXQ(String h_id) {
		return dao.getHappyXQ(h_id);
	}

	// 删除评论
	@Override
	public boolean delHappyComment(Integer c_id) {
		return dao.delHappyComment(c_id) > 0 ? true : false;
	}

	// 添加娱乐商家
	@Override
	public boolean addHappy(Happy happy) {
		return dao.addHappy(happy) > 0 ? true : false;
	}

	// 删除美食商家
	@Override
	public boolean delHappy(Integer h_id) {
		return dao.delHappy(h_id) > 0 ? true : false;
	}

	// 获取所有类型
	@Override
	public List<HappyType> getHappyType() {
		return dao.getHappyType();
	}

	// 修改娱乐商家
	@Override
	public boolean updHappy(Happy happy) {
		return dao.updHappy(happy) > 0 ? true : false;
	}

	// 添加图片组
	@Override
	public boolean addHappyPhotoGroup(HappyPhotoGroup happyPhotoGroup) {
		return dao.addHappyPhotoGroup(happyPhotoGroup) > 0 ? true : false;
	}

	// 组内添加图片
	@Override
	public boolean addHappyPhoto(HappyPhoto happyPhoto) {
		return dao.addHappyPhoto(happyPhoto) > 0 ? true : false;
	}

	// 删除组
	@Override
	public boolean delHappyPhotoGroup(Integer g_id) {
		return dao.delHappyPhotoGroup(g_id) > 0 ? true : false;
	}

	// 删除图片
	@Override
	public boolean delHappyPhoto(String p_id) {
		return dao.delHappyPhoto(p_id) > 0 ? true : false;
	}

	// 获取娱乐项目详情
	@Override
	public HappyTheme getHappyThemeXQ(String t_id) {
		return dao.getHappyThemeXQ(t_id);
	}

	// 删除娱乐项目
	@Override
	public boolean delTheme(Integer t_id) {
		return dao.delTheme(t_id) > 0 ? true : false;
	}

	// 添加娱乐项目
	@Override
	public boolean addTheme(HappyTheme happyTheme) {
		return dao.addTheme(happyTheme) > 0 ? true : false;
	}

	// 添加图片list
	@Override
	public boolean addHappyThemePhoto(HappyThemePhoto happyThemePhoto) {
		return dao.addHappyThemePhoto(happyThemePhoto) > 0 ? true : false;
	}

	// 添加时间表list
	@Override
	public boolean addHappyThemeTime(HappyThemeTime happyThemeTime) {
		return dao.addHappyThemeTime(happyThemeTime) > 0 ? true : false;
	}

	// 修改娱乐项目
	@Override
	public boolean updTheme(HappyTheme happyTheme) {
		return dao.updTheme(happyTheme) > 0 ? true : false;
	}

	// 添加娱乐项目图片
	@Override
	public boolean addThemePhoto(HappyThemePhoto happyThemePhoto) {
		return dao.addThemePhoto(happyThemePhoto) > 0 ? true : false;
	}

	// 删除娱乐项目图片
	@Override
	public boolean delThemePhoto(Integer tp_id) {
		return dao.delThemePhoto(tp_id) > 0 ? true : false;
	}

	// 添加娱乐项目时间段
	@Override
	public boolean addThemeTime(HappyThemeTime happyThemeTime) {
		return dao.addThemeTime(happyThemeTime) > 0 ? true : false;
	}

	// 删除娱乐项目图片
	@Override
	public boolean delThemeTime(Integer ti_id) {
		return dao.delThemeTime(ti_id) > 0 ? true : false;
	}

	// 冻结
	@Override
	public boolean frozenHappy(Integer h_id, String frozen_cycle, String frozen_starttime, String frozen_endtime,
			String frozen_title, String frozen_details) {
		return dao.frozenHappy(h_id, frozen_cycle, frozen_starttime, frozen_endtime, frozen_title, frozen_details) > 0
				? true
				: false;
	}

	@Override
	public PageInfo<Food> selFood(String search, int page, int row) {
		PageHelper.startPage(page, row);
		List<Food> list = dao.selByCondition(search);
		return new PageInfo<>(list, 5);
	}

	@Override
	public PageInfo<Happy> selHappy(String search, int page, int row) {
		PageHelper.startPage(page, row);
		List<Happy> list = dao.selHappyCondition(search);
		return new PageInfo<>(list, 5);
	}

	@Override
	public PageInfo<Hotel> selHotel(String search, int page, int row) {
		PageHelper.startPage(page, row);
		List<Hotel> list = dao.selHotelCondition(search);
		return new PageInfo<>(list, 5);
	}

	// app获取美食列表
	// t_id 类别id
	// search 搜索内容
	// f_theme 主题类别
	// price_start 价格区间低价
	// price_end 价格区间顶价
	// upordown 价格升序或降序 0随机 1升序 2降序
	// service 服务设施 暂无 TODO
	@Override
	public List<Food> getFinefood(String t_id, String search, String f_theme, String price_start, String price_end,
			String upordown, String service) {
		return dao.getFinefood(t_id, search, f_theme, price_start, price_end, upordown, service);
	}

	// 获取所有主题类别
	@Override
	public Set<String> getF_themeList() {
		return dao.getF_themeList();
	}

	// app获取宾馆列表
	// t_id 类别id
	// search 搜索内容
	// price_start 价格区间低价
	// price_end 价格区间顶价
	// upordown 价格升序或降序 0随机 1升序 2降序
	// h_star 星级
	// 好评优先 TODO 暂无
	@Override
	public List<Hotel> getHotel(String t_id, String search, String price_start, String price_end, String upordown,
			String h_star) {
		return dao.getHotel(t_id, search, price_start, price_end, upordown, h_star);
	}

	// app获取娱乐商家列表
	// t_id 类别id
	// search 搜索内容
	// upordown 价格升序或降序 0随机 1升序 2降序
	// installtime 发布时间排序 0随机 1升序 2降序
	// 好评优先 TODO 暂无
	@Override
	public List<Happy> getHappy(String t_id, String search, String upordown, String installtime) {
		return dao.getHappy(t_id, search, upordown, installtime);
	}

}
